home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / tde31.zip / DEFAULT.H < prev    next >
Text File  |  1993-08-29  |  20KB  |  390 lines

  1. /*
  2.  * New editor name:  TDE, the Thomson-Davis Editor.
  3.  * Author:           Frank Davis
  4.  * Date:             June 5, 1991
  5.  *
  6.  * This modification of Douglas Thomson's code is released into the
  7.  * public domain, Frank Davis.  You may distribute it freely.
  8.  *
  9.  * Set up default dispatch table.
  10.  *
  11.  * If you want to change the default key assignments - it's really easy.  All
  12.  * you have to do is set the appropriate array element to the desired function
  13.  * and then recompile the source code.  The available functions are in the
  14.  * define.h file.
  15.  *
  16.  * The key code returned by pressing a function key is added to 256.  This is
  17.  * done because it makes it easy to allow the ASCII and Extended ASCII
  18.  * characters to get thru as normal characters and to trap the function keys
  19.  * because they are greater than 256.  Once a function is detected, 256 is
  20.  * subtracted from the key code, which maps the function key codes to
  21.  * 0-256 (MAX_KEYS).  See function getfunc( ) in console.c.
  22.  *
  23.  * Look in the back of the MSC 6.0a manual or a MASM manual to find out what
  24.  * the extended codes are for the various key combinations.  For example,
  25.  * ALT+M = 50.  Add 50 to 256 which equals 306.
  26.  *
  27.  * **************************************************************************
  28.  * **** In tde, version 1.4, I added support for assigning characters    ****
  29.  * **** to Control and Alt keys.  This allows those who need various     ****
  30.  * **** accent and dot characters to assign any ASCII or Extended ASCII  ****
  31.  * **** character to unused function keys.                               ****
  32.  * **************************************************************************
  33.  *
  34.  * **************************************************************************
  35.  * **** In tde, version 1.5, I took out support for assigning characters ****
  36.  * **** to Control and Alt keys.  Macros may now be assigned to function ****
  37.  * **** keys, which will accomplish the same task.                       ****
  38.  * **************************************************************************
  39.  *
  40.  * If you change the default key assignments, you should also change the help
  41.  * screen in help.h to show what function the new keys are assigned to.
  42.  *
  43.  * The insert_overwrite function is assigned the index of 0.  If the key
  44.  * code is less than 256 then a character is written to the file.  DO NOT
  45.  * assign any function to 256, it is used to call insert_overwrite( ) and
  46.  * add text characters to the file.  DO NOT put an index to it in the
  47.  * cfgkeys utility.
  48.  *
  49.  * See the end of this file for default two-key assignments.
  50.  */
  51.  
  52. KEY_FUNC key_func = {
  53.      "$  keys",             /* signature for the .exe file */
  54. /* 256 */
  55.      0,                     /* DO NOT assign this to any function */
  56.      0,                     /* Alt + ESC  -  101 Keyboard */
  57.      AbortCommand,          /* ESC    - manually map to 258 */
  58.      0,                     /* #ESC   - manually map to 259 */
  59. /* 260 */                   
  60.      ClearAllMacros,        /* ^ESC    - mannuall map to 260 */
  61.      0,                     /* no key assigned here */
  62.      Rturn,                 /*  Enter  - manually map to 262 */
  63.      NextLine,              /* #Enter  - manually map to 263 */
  64.      BegNextLine,           /* ^Enter  - manually map to 264 */
  65.      BackSpace,             /*  BackSpace - manually map to 265 */
  66.      BackSpace,             /* #BackSpace - manually map to 266 */
  67.      0,                     /* ^BackSpace - manually map to 267 */
  68.      Tab,                   /*  Tab       - manually map to 268 */
  69.      0,                     /* Control-Break - manually map to 269
  70.                              *    DO NOT assign any function to Control-Break.
  71.                              *    It is used to stop run away functions.
  72.                              */
  73. /* 270 */                   
  74.      0,                     /* Alt + Backspace  - 101 keyboard */
  75.      BackTab,               /* Shift + Tab */
  76.      Quit,                  /* Alt-Q  272 */
  77.      BlockToFile,           /* Alt-W  273 */
  78.      BlockExpandTabs,       /* Alt-E  274 */
  79.      ToggleRuler,           /* Alt-R  275 */
  80.      BlockTrimTrailing,     /* Alt-T  276 */
  81.      UndoDelete,            /* ALT-Y  277 */
  82.      UnMarkBlock,           /* Alt-U  278 */
  83.      ToggleIndent,          /* Alt-I  279 */
  84. /* 280 */                   
  85.      OverlayBlock,          /* Alt-O  280 */
  86.      PrintBlock,            /* Alt-P  281 */
  87.      0,                     /* Alt-[     - 101 keyboard */
  88.      0,                     /* Alt-]     - 101 keyboard */
  89.      0,                     /* Alt-Enter - 101 keyboard */
  90.      0,                     /* manually map Grey Enter to this hole */
  91.      AddLine,               /* Alt-A  286 */
  92.      SortBoxBlock,          /* Alt-S  287 */
  93.      DeleteLine,            /* Alt-D  288 */
  94.      FillBlock,             /* Alt-F  289 */
  95. /* 290 */                   
  96.      DeleteBlock,           /* Alt-G  290 */
  97.      Help,                  /* Alt-H  291 */
  98.      JoinLine,              /* Alt-J  292 */
  99.      KopyBlock,             /* Alt-K  293 */
  100.      MarkLine,              /* Alt-L  294 */
  101.      0,                     /* Alt-;: - 101 keyboard */
  102.      0,                     /* Alt-'" - 101 keyboard */
  103.      0,                     /* Alt-`~ - 101 keyboard */
  104.      0,                     /* manually map Shift+Grey Enter to this hole */
  105.      0,                     /* manually map Control+Greay Enter to this hole */
  106. /* 300 */                   
  107.      ToggleZ,               /* Alt-Z  300 */
  108.      MarkStream,            /* Alt-X  301 */
  109.      CopyBlock,             /* Alt-C  302 */
  110.      ToggleWordWrap,        /* Alt-V  303 */
  111.      MarkBox,               /* Alt-B  304 */
  112.      NumberBlock,           /* Alt-N  305 */
  113.      MoveBlock,             /* Alt-M  306 */
  114.      BlockUpperCase,        /* Alt-<  added for 83/84 keyboards, fmd */
  115.      BlockLowerCase,        /* Alt->  added for 83/84 keyboards, fmd */
  116.      BlockStripHiBit,       /* ALt-?  added for 83/84 keyboards, fmd */
  117. /* 310 */                   
  118.      0,                     /*  hole in key codes, not used */
  119.      0,                     /*  hole in key codes, not used */
  120.      0,                     /*  hole in key codes, not used */
  121.      0,                     /*  hole in key codes, not used */
  122.      0,                     /*  hole in key codes, not used */
  123.      Help,                  /* F1     315 */
  124.      Save,                  /* F2     316 */
  125.      Quit,                  /* F3     317 */
  126.      File,                  /* F4     318 */
  127.      RepeatFindForward1,    /* F5     319 */
  128. /* 320 */                   
  129.      RepeatFindBackward1,   /* F6     320 */
  130.      RepeatFindRegX,        /* F7     321 */
  131.      SplitVertical,         /* F8     322 */
  132.      SplitHorizontal,       /* F9     323 */
  133.      NextWindow,            /* F10    324 */
  134.      0,                     /*  hole in key codes, not used */
  135.      0,                     /*  hole in key codes, not used */
  136.      BegOfLine,             /* Home   327 */
  137.      LineUp,                /* Up     328 */
  138.      ScreenUp,              /* PgUp   329 */
  139. /* 330 */                   
  140.      0,                     /*  hole in key codes, not used */
  141.      CharLeft,              /* Left   331 */
  142.      CenterWindow,          /* Center 332 */
  143.      CharRight,             /* Right  333 */
  144.      0,                     /*  hole in key codes, not used */
  145.      EndOfLine,             /* End    335 */
  146.      LineDown,              /* Down   336 */
  147.      ScreenDown,            /* PgDn   337 */
  148.      ToggleOverWrite,       /* Ins    338 */
  149.      DeleteChar,            /* Del    339 */
  150. /* 340 */                   
  151.      SaveMacro,             /* Shift F1  */
  152.      SaveAs,                /* Shift F2  */
  153.      LoadMacro,             /* Shift F3  */
  154.      EditFile,              /* Shift F4  */
  155.      FindForward,           /* Shift F5  */
  156.      FindBackward,          /* Shift F6  */
  157.      FindRegX,              /* Shift F7  */
  158.      ReplaceString,         /* Shift F8  */
  159.      SizeWindow,            /* Shift F9  */
  160.      PreviousWindow,        /* Shift F10 */
  161. /* 350 */                   
  162.      ToggleSync,            /* Control F1 */
  163.      ToggleEol,             /* Control F2 */
  164.      ToggleCRLF,            /* Control F3 */
  165.      ToggleTrailing,        /* Control F4 */
  166.      ToggleSearchCase,      /* Control F5 */
  167.      SetLeftMargin,         /* Control F6 */
  168.      SetRightMargin,        /* Control F7 */
  169.      SetParagraphMargin,    /* Control F8 */
  170.      ZoomWindow,            /* Control F9  */
  171.      NextHiddenWindow,      /* Control F10 */
  172. /* 360 */                   
  173.      DirList,               /* Alt-F1   360 */
  174.      SetFileAttributes,     /* Alt-F2   361 */
  175.      RecordMacro,           /* Alt-F3   362 */
  176.      EditNextFile,          /* Alt-F4   363 */
  177.      NextDirtyLine,         /* Alt-F5   364 */
  178.      PrevDirtyLine,         /* Alt-F6   365 */
  179. /*     FormatParagraph,   */    /* Alt-F7   366 */
  180.      RepeatFindRegXBackward,/* Alt-F7   366 */
  181.      LeftJustify,           /* Alt-F8   367 */
  182.      RightJustify,          /* Alt-F9   368 */
  183.      CenterJustify,         /* Alt-F10  369 */
  184. /* 370 */                   
  185.      0,                     /*  hole in key codes, not used */
  186.      WordLeft,              /* Control Left  371 */
  187.      WordRight,             /* Control Right 372 */
  188.      BotOfScreen,           /* Control End   373 */
  189.      EndOfFile,             /* Control PgUp  374 */
  190.      TopOfScreen,           /* Control Home  375 */
  191.      SetMark1,              /* Alt-1! */
  192.      SetMark2,              /* Alt-2@ */
  193.      SetMark3,              /* Alt-3# */
  194.      0,                     /* Alt-4$ */
  195. /* 380 */                   
  196.      0,                     /* Alt-5% */
  197.      0,                     /* Alt-6^ */
  198.      0,                     /* Alt-7& */
  199.      0,                     /* Alt-8* */
  200.      0,                     /* Alt-9( */
  201.      0,                     /* Alt-0) */
  202.      DelEndOfLine,          /* Alt '-'  386      */
  203.      DuplicateLine,         /* Alt '='  387      */
  204.      TopOfFile,             /* Control Pgup  388 */
  205.      RepeatDiff,            /* F11          - 101 keyboard */
  206. /* 390 */                   
  207.      RepeatGrep,            /* F12          - 101 keyboard */
  208.      DefineDiff,            /* Shift F11    - 101 keyboard */
  209.      DefineGrep,            /* Shift F12    - 101 keyboard */
  210.      0,                     /* Control F11  - 101 keyboard */
  211.      DefineRegXGrep,        /* Control F12  - 101 keyboard */
  212.      0,                     /* Alt F11      - 101 keyboard */
  213.      RepeatFindRegX,        /* Alt F12      - 101 keyboard */
  214.      ScrollUpLine,          /* Control Up */
  215.      PanUp,                 /* Control Grey - */
  216.      CenterLine,            /* Control Center */
  217. /* 400 */                   
  218.      PanDn,                 /* Control Grey + */
  219.      ScrollDnLine,          /* Control Down   */
  220.      0,                     /* Control Ins    */
  221.      StreamDeleteChar,      /* Control Del    */
  222.      SetTabs,               /* Control TAB    */
  223.      0,                     /* Control Grey /  */
  224.      0,                     /* Control Grey *  */
  225.      0,                     /* Alt + Grey Home  */
  226.      PanUp,                 /* Alt + Grey Up    */
  227.      HorizontalScreenLeft,  /* Alt + Grey PgUp  */
  228. /* 410 */                   
  229.      0,                     /*  hole in key codes, not used */
  230.      PanLeft,               /* Alt + Grey Left  */
  231.      0,                     /*  hole in key codes, not used */
  232.      PanRight,              /* Alt + Grey Right */
  233.      0,                     /*  hole in key codes, not used */
  234.      0,                     /* Alt + Grey End   */
  235.      PanDn,                 /* Alt + Grey Down  */
  236.      HorizontalScreenRight, /* Alt + Grey PgDn  */
  237.      0,                     /* Alt + Grey Ins   */
  238.      0,                     /* Alt + Grey Del   */
  239. /* 420 */                   
  240.      0,                     /* Alt + Grey /     */
  241.      ToggleSmartTabs,       /* Alt + Tab        */
  242.      0,                     /* Alt + Grey Enter */
  243.      ScrollUpLine,          /* Shift Grey - (Num Lock off), fmd key */
  244.      ScrollDnLine,          /* Shift Grey + (Num Lock off), fmd  key */
  245.      Rturn,                 /* Hard code Enter to 425 - DO NOT let users
  246.                              * change, used in the reassignment of
  247.                              * ALT-013 <lf> */
  248.      PanLeft,               /* hard code - control+shift+left, fmd key  */
  249.      PanRight,              /* hard code - control+shift+right, fmd key */
  250.      0,                     /* no keys are assigned here */
  251.      0,                     /* no keys are assigned here */
  252.  
  253.    /*
  254.     * Add 430 to keycodes 0-31 if ALT key is not pressed.  This effectively
  255.     * remaps the Control code sequence to 430-461.
  256.     */
  257.  
  258. /* 430 */
  259.      DateTimeStamp,         /* Control @ - remapped in main.c */
  260.      WordLeft,              /* Control a */
  261.      FormatText,            /* Control b */
  262.      ScreenDown,            /* Control c */
  263.      CharRight,             /* Control d */
  264.      LineUp,                /* Control e */
  265.      WordRight,             /* Control f */
  266.      DeleteChar,            /* Control g */
  267.      BackSpace,             /* Control h */
  268.      Tab,                   /* Control i */
  269.      Help,                  /* Control j */
  270.      TwoCharKey,            /* Control k */
  271.      0,                     /* Control l */
  272.      Rturn,                 /* Control m */
  273.      AddLine,               /* Control n */
  274.      0,                     /* Control o */
  275.      Pause,                 /* Control p */
  276.      0,                     /* Control q */
  277.      ScreenUp,              /* Control r */
  278.      CharLeft,              /* Control s */
  279.      WordDelete,            /* Control t */
  280.      UndoDelete,            /* Control u */
  281.      ToggleOverWrite,       /* Control v */
  282.      ScrollUpLine,          /* Control w */
  283.      LineDown,              /* Control x */
  284.      DeleteLine,            /* Control y */
  285.      ScrollDnLine,          /* Control z */
  286.      AbortCommand,          /* Control [ */
  287.      RedrawScreen,          /* Control \ */
  288.      ParenBalance,          /* Control ] */
  289. /* 460 */
  290.      0,                     /* Control ^     460 */
  291.      SplitLine,             /* Control _     461 */
  292.      GotoMark1,             /* Shift Alt 1!  462 */
  293.      GotoMark2,             /* Shift Alt 2@  463 */
  294.      GotoMark3,             /* Shift Alt 3#  464 */
  295.      0,                     /* Shift Alt 4$  465 */
  296.      0,                     /* Shift Alt 5%  466 */
  297.      0,                     /* Shift Alt 6^  467 */
  298.      0,                     /* Shift Alt 7&  468 */
  299.      0,                     /* Shift Alt 8*  469 */
  300. /* 470 */
  301.      0,                     /* Shift Alt 9(  470 */
  302.      0,                     /* Shift Alt 0)  471 */
  303.      0,                     /* Shift Alt -_  472 */
  304.      0,                     /* Shift Alt +=  473 */
  305.      DefineGrep,            /* Shift Alt-Q   474 */
  306.      RepeatGrep,            /* Shift Alt-W   475 */
  307.      0,                     /* Shift Alt-E   476 */
  308.      0,                     /* Shift Alt-R   477 */
  309.      ToggleTabInflate,      /* Shift Alt-T   478 */
  310.      0,                     /* Shift ALT-Y   479 */
  311. /* 480 */
  312.      0,                     /* Shift Alt-U   480 */
  313.      BlockIndentTabs,       /* Shift Alt-I   481 */
  314.      0,                     /* Shift Alt-O   482 */
  315.      0,                     /* Shift Alt-P   483 */
  316.      0,                     /* Shift Alt-[     - 101 keyboard */
  317.      0,                     /* Shift Alt-]     - 101 keyboard */
  318.      0,                     /* Shift Alt-Enter - 101 keyboard */
  319.      0,                     /* hole in the key codes here */
  320.      0,                     /* Shift Alt-A   488 */
  321.      SwapBlock,             /* Shift Alt-S   489 */
  322. /* 490 */
  323.      RepeatDiff,            /* Shift Alt-D   490 */
  324.      0,                     /* Shift Alt-F   491 */
  325.      0,                     /* Shift Alt-G   492 */
  326.      0,                     /* Shift Alt-H   493 */
  327.      JumpToLine,            /* Shift Alt-J   494 */
  328.      0,                     /* Shift Alt-K   495 */
  329.      0,                     /* Shift Alt-L   496 */
  330.      0,                     /* Shift Alt-;: - 101 keyboard */
  331.      0,                     /* Shift Alt-'" - 101 keyboard */
  332.      0,                     /* Shift Alt-`~ - 101 keyboard */
  333. /* 500 */
  334.      0,                     /* hole in the key codes here */
  335.      0,                     /* see pages 194-195 of MASM man. for more info */
  336.      0,                     /* Shift Alt-Z   502 */
  337.      0,                     /* Shift Alt-X   503 */
  338.      BlockCompressTabs,     /* Shift Alt-C   504 */
  339.      0,                     /* Shift Alt-V   505 */
  340.      0,                     /* Shift Alt-B   506 */
  341.      0,                     /* Shift Alt-N   507 */
  342.      0,                     /* Shift Alt-M   508 */
  343.      BlockRot13,            /* Shift Alt-<  added for 83/84 keyboards, fmd */
  344. /* 510 */
  345.      BlockFixUUE,           /* Shift Alt->  added for 83/84 keyboards, fmd */
  346.      BlockEmailReply        /* Shift ALt-?  added for 83/84 keyboards, fmd */
  347. };
  348.  
  349.  
  350. /*
  351.  * there are MAX_TWO_KEY == 128 combinations for user customization.
  352.  *   the first entry is the first key and the second entry is the next
  353.  *   key.  the function assigned to the two-key combination is the last
  354.  *   entry.
  355.  *
  356.  * the first key entry MUST be a recognized function key.  the second key
  357.  *   can be any any ASCII, Extended ASCII, or function key.  the second key
  358.  *   may even be a repeat of the first function key.
  359.  */
  360. TWO_KEY two_key_list = {
  361.    "$twokey",
  362.    { { _CNTRL_K, 'q', Quit },       /* example */
  363.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },  /* 6 */
  364.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
  365.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
  366.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
  367.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },  /* 26 */
  368.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
  369.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
  370.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
  371.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
  372.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },  /* 51 */
  373.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
  374.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
  375.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
  376.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
  377.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },  /* 76 */
  378.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
  379.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
  380.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
  381.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
  382.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },  /* 101 */
  383.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
  384.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
  385.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
  386.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
  387.    { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },  /* 126 */
  388.    { 0, 0, 0 }, { 0, 0, 0 } }
  389. };
  390.